#include "Action.h"
#include "..\utils\Log.h"
#include "..\utils\StringUtils.h"

namespace ds {

Action::Action(const char* name) {
	strncpy(m_Name,name,32);
	m_Hash = string::murmur_hash(name,strlen(name),0);
}
// --------------------------------------------
//
// --------------------------------------------
ActionGroup::~ActionGroup() {
	LOGC(logINFO,"ActionGroup") << "destructing action group " << getName();
	m_Actions.deleteContents();
}

void ActionGroup::start() {
	for ( uint32 i = 0; i < m_Actions.num(); ++i ) {
		m_Actions[i]->start();
	}
	setActive(true);
}

void ActionGroup::stop() {
	for ( uint32 i = 0; i < m_Actions.num(); ++i ) {
		m_Actions[i]->stop();
	}
	setActive(false);
}

void ActionGroup::update(float elapsed) {
	for ( uint32 i = 0; i < m_Actions.num(); ++i ) {
		m_Actions[i]->update(elapsed);
	}
}

}
